#! /bin/sh
# Test the LightWAVE server

cd `dirname $0`
if [ $# == 1 ]
then
   LW=$1/lightwave
else
   LW=lightwave
fi

cat >lw-test-params <<EOF
fetch
mitdb
200
0
1

atr

0
1
EOF

$LW i <lw-test-params >lw-test-$$ 2>/dev/null
if (diff -q lw-test-$$ lw-test-output)
then
    echo The LightWAVE server appears to be running properly in command-line mode.
    echo Test it with the LightWAVE client by pointing your web browser to:
    echo "    http://localhost/lightwave/"
    rm lw-test-$$
else
    echo The LightWAVE server is not running properly.
    echo The expected test output is in "check/lw-test-output".
    echo The output generated by the test is in "check/lw-test-$$".
fi